# -*- encoding : utf-8 -*-
# 采集网络数据

require 'spidr'

class Collecter

    attr_reader :url,:type

    def initialize(url,type = 'page')
        @url,@type = url,type
    end

    def get_page
        if defined? "::Spidr"
            Spidr.start_at(url,{:max_depth => 0}) do |spider|
              spider.every_page { |content| puts content }
            end
        else
        end
    end

    def to_s
        "#{$lang[:collect]}#{$lang[type.to_sym]} #@url"
    end
end
